// @Author EthanScriptOn
// @Desc
package holder

import "time"

type ExecuteTimeUnit string

const (
	MILLISECOND ExecuteTimeUnit = "MILLISECOND"
	SECOND      ExecuteTimeUnit = "SECOND"
)

type ExecuteState string

const (
	EXECUTE_PREPARATION ExecuteState = "EXECUTE_PREPARATION"
	EXECUTE_SUCCESS     ExecuteState = "EXECUTE_SUCCESS"
	EXECUTE_FAIL        ExecuteState = "EXECUTE_FAIL"
	EXECUTE_INTERRUPT   ExecuteState = "EXECUTE_INTERRUPT"
	EXECUTE_TIME_OUT    ExecuteState = "EXECUTE_TIME_OUT"
)

func (e ExecuteTimeUnit) ExecuteTimeUnitToDuration() time.Duration {
	switch e {
	case MILLISECOND:
		return time.Millisecond
	case SECOND:
		return time.Second
	}
	return time.Millisecond
}
